
package com.example.hidevirtualkey;

import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;

public class MainActivity extends Activity {
    private View mRoot;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mRoot = LayoutInflater.from(getApplicationContext()).inflate(R.layout.activity_main, null);
        setContentView(mRoot);
        setOnclickHideVirtualKey();
    }

    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    private void setOnclickHideVirtualKey() {
        if (mRoot != null) {
            mRoot.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    mRoot.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
                }
            });
        }
    }

}
